﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Sinacor.OrderMessageManager.Configuration.Receptor;

namespace Sinacor.OrderMessageManager.Receptor
{
    /// <summary>
    /// Gerenciador das sessões de comunicação
    /// </summary>
    public class SessionManager
    {

        private static SessionManager _sessionManager = null;
        private static Mutex _mutex = new Mutex();

        public static SessionManager GetInstance()
        {
            try
            {
                _mutex.WaitOne();

                if (_sessionManager == null)
                {
                    _sessionManager = new SessionManager();
                }
            }
            finally
            {
                _mutex.ReleaseMutex();
            }

            return _sessionManager;
        }

        /// <summary>
        /// Inicia o carregamento das sessões
        /// </summary>
        public void Start()
        {
            ReceptorConfiguration receptorConfiguration = ReceptorConfigurationManager.ReceptorConfiguration;
        }

        /// <summary>
        /// Descarrega as sessões
        /// </summary>
        public void Stop()
        {

        }
    }
}
